﻿var ret
var s
var question
var desc
var regno
var macro
var macro1
var result
macro = "Code: TAB T=1" + "\n";
//macro += "URL GOTO=http://www.auengineers.com/unanswered" + "\n";
//macro += "TAG POS=5 TYPE=A ATTR=class:qa-q-link&&TXT:*" + "\n";
macro +="TAG POS=1 TYPE=SPAN ATTR=class:entry-title&&TXT:* EXTRACT=TXT" + "\n";
macro +="TAG POS=1 TYPE=DIV ATTR=class:entry-content&&TXT:* EXTRACT=TXT"+ "\n";
iimDisplay ("Get the Reg No:");
ret = iimPlay(macro);

/* Check for error */
if (ret == 1){
question = iimGetLastExtract(1);
if(question.match(/[0-9]{8}/g))
{
regno =   question.match(/[0-9]{8}/g);
iimDisplay ("Matched:  " + regno);
}
else 
{
desc =  iimGetLastExtract(2);
regno =   desc.match(/[0-9]{8}/g);
iimDisplay ("Matched1111:  " + regno);
}
macro1 = "Code: TAB T=1" + "\n";
macro1 +="TAB OPEN" + "\n";
macro1 +="TAB T=2" + "\n";
macro1 +="URL GOTO=http://localhost:8080/tancet.php/?q="+regno + "\n";
macro1 +="TAG POS=1 TYPE=DIV ATTR=TXT:* EXTRACT=TXT" + "\n";
macro1 +="TAB CLOSE" + "\n"; ret = iimPlay(macro1);

if(ret==1)
{
result = iimGetLastExtract(1);
iimSet("RESULT1",result);
macro = "Code: TAB T=1" + "\n";
macro += "TAG POS=1 TYPE=TEXTAREA FORM=NAME:a_form ATTR=ID:a_content CONTENT={{RESULT1}}" +"\n";
macro += "TAG POS=1 TYPE=LABEL FORM=NAME:a_form ATTR=TXT:Email<SP>me<SP>(karthic+auengineers@jeno.in)<SP>if<SP>my*" +"\n";
macro += "TAG POS=1 TYPE=INPUT:CHECKBOX FORM=NAME:a_form ATTR=NAME:a_notify CONTENT=NO" +"\n";
macro += "TAG POS=1 TYPE=INPUT:SUBMIT FORM=NAME:a_form ATTR=*" +"\n";
iimDisplay(result);
iimPlay(macro);
}
}else
{
	iimDisplay("The following error occurred: "+iimGetLastError());
}

